package org.neuedu.ssmp.crm.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import lombok.extern.slf4j.Slf4j;
import org.neuedu.ssmp.crm.entity.Relationship;
import org.neuedu.ssmp.crm.entity.vo.ResponseEntity;
import org.neuedu.ssmp.crm.service.IRelationshipService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Auther: Administrator
 * @Date: 2019/12/18 19:20
 * @Description:
 */
@RestController
@RequestMapping("/ship")
@Slf4j
public class RelationshipController {
    @Autowired
    private IRelationshipService service;

    @PostMapping("add")
    public ResponseEntity add(@RequestBody Relationship relationship){
        service.save(relationship);
        return ResponseEntity.ok("成功");
    }
    @PostMapping("selcet")
    public List<Relationship> set(@RequestParam Integer id){
        QueryWrapper<Relationship> wrapper=new QueryWrapper<>();
        wrapper.eq("customer_id",id);
        return service.list(wrapper);
    }
}
